Analytic Templates are pairs of commands that originate in Command Templates. The command pairs are shown as Pre and Post on the app interface. Unlike Command Templates, the Analytic Templates do not run commands on devices at execution time, but instead utilize responses that have been collected at earlier automation stages by the Command Templates. The output of the Pre and Post commands in Analytic Templates is evaluated against each other according to a set of associated analytic rules.
See the Command Templates guide for additional information.
Prerequisites
- Working NSO instance.
- At least one device with a live-status capable NED. Netsim devices may not work.
itential_tools
NSO package pre-loaded.
Create Analytic Templates
To create a new Analytic Template:
Click Automation Studio in the left navbar of the IAP home page to open the application.
Click the plus (+) icon in the top toolbar to open the Create dialog.
Figure 1: Create Button
Select Analytic Template from the dropdown list.
Figure 2: Select Analytic Template
Enter a name for your template and click Create. The Analytic Template form displays.
Figure 3: Create Analytic Template
Using Analytic Templates
The various UI elements and user actions to define an Analytic Template are outlined in the table below.
Figure 4: Defining the Analytic Template
UI Label | Description |
---|---|
1 | Select a device from the Device Name field dropdown, or click the magnifying glass to search for a device. |
2 | Set the global pass flag (All Commands/One Command must pass) using the dropdown. See the Global Command Pass section below. |
3 | Select the appropriate Command Template in the Pre Template and Post Template dropdown list to pull commands from. |
4 | Set the appropriate command pair (Pre and Post Command) to test against the device. |
5 | Select the Rules type and Severity level. |
6 | Click the + Rule button to add a new rule to the command. |
7 | Set the global pass flag (All Rules/One Rule must pass) for rules using the dropdown. See the Global Rules Pass section below. |
8 | Click Test Run to test the command. After evaluating the response, the associated rules will be marked with either a green check mark (passed) or red minus sign (failed). The device response will also appear at the bottom of the screen. |
9 | Click + Command Pair to add a new command to the Analytic template. |
Global Command Pass
At the top of the template is a dropdown menu (All Commands must pass/ One Command must pass) that works on a global level.
Figure 5: Command Pass Options
- All commands must pass (default): Pass for every rule in every command.
- All commands must pass (warn/info as pass checked): Zero errors errors present in the template.
- One command must pass (default behavior): Pass for all rules in ONE (or more) commands.
- One command must pass (warn/info as pass checked): One command with zero errors must be present in the template.
Rules
The following options are available in the Rules dropdown for all Analytic Templates.
Figure 6: Analytic Template Rules
Rule | Description |
---|---|
regex |
Allows you to extract specific values (using parentheses) and compare them against each other with one of the following relationships. See the section below for available operators. |
table |
Allows the extraction of key and values from a table dataset, and then compares if all keys and values are the same. It is useful for datasets that may change their order. |
matches |
Compares the Pre and Post responses entirely. This rule passes when both responses are equivalent. Under the ignore pattern, it is possible (not mandatory) to specify a regular expression to be ignored during comparison (time stamp in the use case below). |
!matches |
Compares the Pre and Post responses entirely. This rule passes when the responses are different. Under the ignore pattern, it is possible (not mandatory) to specify a regular expression to be ignored during comparison. |
Regex Operators
The following regex operators are available.
Figure 7: Regex Operator Options
Operator | Description |
---|---|
= | String. Numbers are equal. |
!= | String. Numbers are not equal. |
<= | Pre-number is less than or equal to Post-number. |
< | Pre-number is less than Post-number. |
>= | Pre-number is greater than or equal to Post-number. |
> | Pre-number is greater than Post-number. |
% | Evaluates a percentage value calculation against a threshold. The percentage value is calculated by multiplying 100 times the Post-Regex value divided by the Pre-Regex value: 100 x (Post-Regex / Pre-Regex). The threshold is a static number typed in the Post/Pre % field. The rule returns true if the calculated percentage value is greater than or equal to the threshold; otherwise it returns false. |
Severity
Apply a Severity level to a rule after it has failed. The default severity is error
.
Figure 8: Rule Severity Options
Level | Description |
---|---|
error | Something is wrong or is not behaving normally, and a specific action may need to be taken. |
warning | There is something to be aware of that could potentially cause a problem. |
info | Informational messages have been logged. |
Flags
For select Rules (matches, !matches
), a command may have one or more rules which are bound by a boolean Flag called a "pass flag".
- When a pass flag is set to
true
(on), the logic between the rules is "AND". This means all rules must pass in order for the command to pass. - When a pass flag is set to
false
(off), the logic is "OR". This means that only one rule has to pass for the command to pass.
Flag | Description |
---|---|
i |
Ignore case. Make the whole expression case-insensitive. |
g |
Global search. Retain the index of the last match, allowing iterative searches. |
m |
Multi-line. Beginning/end anchors (^ /$ ) will match the start/end of a line. |
Global Rules Pass
For each command there is a dropdown (All Rules must pass/ One Rule must pass) that works the same as setting rules on each command, except on a global level.
- All Rules must pass: Pass for every rule in a command.
- One Rule must pass: Pass for one rule (or more) in a command.
Figure 9: Flag Options & Global Rules Pass